package com.uzai.common.enums;

/**
 * @Auther: jianghan
 * @Date: 2021/8/26 17:52
 * @Description:
 */
public enum YesOrNoEnum {
    NO(0,"NO"),
    YES(1,"YES");
    private Integer value;
    private String desc;
    public static final int NO_VALUE = 0;
    public static final int YES_VALUE = 1;
    YesOrNoEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static YesOrNoEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (YesOrNoEnum type: YesOrNoEnum.values()) {
            if (type.getValue().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
